(function(r) {
  r(CodeMirror);
})(function(CodeMirror) {
  CodeMirror.defineMode("atformula", function(r, t) {
    t.client;
    var d = t.atoms || { false: !0, true: !0, null: !0 }, a = t.builtin || {}, i = t.keywords || {}, x = t.atKeywords || {};
    t.operatorChars;
    var c = t.support || {};
    t.hooks;
    var I = t.dateSQL || { date: !0, time: !0, timestamp: !0 };
    t.backslashStringEscapes;
    var l = t.brackets || /^[\{}\(\)\[\]]/, m = t.punctuation || /^[;.,:]/, y = t.bokeys || {};
    function p(e, n) {
      var s = e.next();
      if (c.hexNumber && (s == "0" && e.match(/^[xX][0-9a-fA-F]+/) || (s == "x" || s == "X") && e.match(/^'[0-9a-fA-F]+'/)))
        return "number";
      if (l.test(s))
        return e.eatWhile(l), "bracket";
      if (m.test(s))
        return e.eatWhile(m), "punctuation";
      e.eatWhile(/^[_\w\d]/);
      var o = e.current();
      return I.hasOwnProperty(o) && (e.match(/^( )+'[^']*'/) || e.match(/^( )+"[^"]*"/)) ? "number" : d.hasOwnProperty(o) ? "atom" : a.hasOwnProperty(o) ? "builtin" : i.hasOwnProperty(o) || x.hasOwnProperty(o) ? "keyword" : y.hasOwnProperty(o) ? "param" : "test";
    }
    function u(e, n, s) {
      n.context = {
        prev: n.context,
        indent: e.indentation(),
        col: e.column(),
        type: s
      };
    }
    function T(e) {
      e.indent = e.context.indent, e.context = e.context.prev;
    }
    return {
      startState: function() {
        return { tokenize: p, context: null };
      },
      token: function(e, n) {
        if (e.sol() && n.context && n.context.align == null && (n.context.align = !1), n.tokenize == p && e.eatSpace())
          return null;
        var s = n.tokenize(e, n);
        if (s == "comment")
          return s;
        n.context && n.context.align == null && (n.context.align = !0);
        var o = e.current();
        return o == "(" ? u(e, n, ")") : o == "[" ? u(e, n, "]") : n.context && n.context.type == o && T(n), s;
      },
      indent: function(e, n) {
        var s = e.context;
        if (!s)
          return CodeMirror.Pass;
        var o = n.charAt(0) == s.type;
        return s.align ? s.col + (o ? 0 : 1) : s.indent + (o ? 0 : r.indentUnit);
      },
      blockCommentStart: "/*",
      blockCommentEnd: "*/",
      lineComment: c.commentSlashSlash ? "//" : c.commentHash ? "#" : "--",
      closeBrackets: "()[]{}''\"\"``"
    };
  }), function() {
    let defaultAtExpressKeywords = "@AWS5SessionId() @AWS5WebURL(*url) @TaskSameHuman(*nextUserTaskDefId,isPerformer,taskInstId) @abs(*num) @activityDefDurationTime(taskInstId) @activityDefExt(taskInstId) @activityDefId(taskInstId) @activityDefName(taskInstId) @activityDefNo(taskInstId) @activityDefWarningTime(taskInstId) @and(*logical1,*logical2,logical3,logical4,logical5) @ascii(*str) @boItemPropVal(*boName,*fieldName,*prop) @calc(*expression) @char(*ascii) @clientIp @companyExt1(contextType,contextId) @companyExt2(contextType,contextId) @companyExt3(contextType,contextId) @companyExt4(contextType,contextId) @companyExt5(contextType,contextId) @companyId(contextType,contextId) @companyName(contextType,contextId) @companyNo(contextType,contextId) @companyType(contextType,contextId) @date() @date2Chinese(*date) @dateAdd(*datepart,*number,*date) @datetime() @dayOfMonth(date) @dayOfYear(date) @decode(*str) @departmentExt1(contextType,contextId) @departmentExt2(contextType,contextId) @departmentExt3(contextType,contextId) @departmentExt4(contextType,contextId) @departmentExt5(contextType,contextId) @departmentId(contextType,contextId) @departmentManager(isIgnoreMe,contextType,contextId) @departmentName(contextType,contextId) @departmentNo(contextType,contextId) @departmentPathId(contextType,contextId) @departmentPathName(contextType,contextId) @departmentType(contextType,contextId) @departmentZone(contextType,contextId) @deviceType() @dictValue(*dictKey,*itemNo,fieldName) @encode(*str) @equals(*str1,*str2) @execJXPath(*jxpath) @execJavaBean(*appId,*className,param) @form(*boName,*fieldName,processInstId) @formDefId() @formItemDefId() @formTheme @getAppName(appId) @getDWCondition(*fieldName,*fieldValue) @getHistoryTaskNum(@uid) @getJgdwType @getMyCreateTaskNum(@uid) @getProperty(*name,appId) @getTodoTaskNum(@uid) @gridAvg(*boName,*fieldName,sqlClause,processInstId) @gridCount(*boName,sqlClause,processInstId) @gridFirst(*boName,*fieldName,sqlClause,processInstId) @gridLast(*boName,*fieldName,sqlClause,processInstId) @gridMax(*boName,*fieldName,sqlClause,processInstId) @gridMin(*boName,*fieldName,sqlClause,processInstId) @gridSum(*boName,*fieldName,sqlClause,processInstId) @hour(datetime) @i18n(*key,*appId,lang) @if(*logical,*valueTrue,*valueFalse) @in(*str1,*str2,str3,str4,str5) @indexOf(*str1,*str2) @isActive(*appId) @isDepartmentManager(contextType,contextId) @isLeapYear(date) @isProcessEnd(contextType,contextId) @isSubProcess(contextType,contextId) @isTaskEnd(taskInstId) @lang() @lastIndexOf(*str1,*str2) @len(*str) @lessThan(*num1,*num2) @loadFile(*appId,*fileName) @lower(*str) @lpad(*str,*len,padStr) @max(*num1,*num2,num3,num4,num5) @md5(*str) @min(*num1,*num2,num3,num4,num5) @minute(datetime) @mod(*num1,*num2) @month(date) @monthBegin(date) @monthEnd(date) @nextDate(date) @nullValue(*str1,*str2) @numAdd(*num1,*num2,num3,num4,num5) @numDiv(*num1,*num2,scale) @numMul(*num1,*num2) @numSub(*num1,*num2,num3,num4,num5) @or(*logical1,*logical2,logical3,logical4,logical5) @parentForm(*boName,*parentBoName,*parentFieldName) @phonetic(*str) @portalUrl() @preDate(date) @processBusinessKey(contextType,contextId) @processComment(*activityId,*policy,contextType,contextId) @processCostTime(contextType,contextId) @processCreateTime(contextType,contextId) @processCreateUser(contextType,contextId) @processDefAppId(contextType,contextId) @processDefDurationTime(contextType,contextId) @processDefGroupId(contextType,contextId) @processDefGroupName(contextType,contextId) @processDefId(contextType,contextId) @processDefName(contextType,contextId) @processDefVersionId(contextType,contextId) @processDefWarningTime(contextType,contextId) @processEndTime(contextType,contextId) @processExpireTime(contextType,contextId) @processExt1(contextType,contextId) @processExt2(contextType,contextId) @processExt3(contextType,contextId) @processExt4(contextType,contextId) @processExt5(contextType,contextId) @processExt6(contextType,contextId) @processExt7(contextType,contextId) @processExt8(contextType,contextId) @processId(businessKey) @processParentId(contextType,contextId) @processParentTaskId(contextType,contextId) @processStartTime(contextType,contextId) @processStatus(contextType,contextId) @processTitle(contextType,contextId) @processVar(*varName,contextType,contextId) @quarter(date) @quarterBegin(date) @quarterEnd(date) @replace(*str,*oldStr,*newStr) @rmb(*num) @roleExt1(contextType,contextId) @roleExt2(contextType,contextId) @roleExt3(contextType,contextId) @roleExt4(contextType,contextId) @roleExt5(contextType,contextId) @roleName(contextType,contextId) @roleNameKey(contextType,contextId) @roleNoUsers(*no,delimiter) @roleUsers(*roleId,delimiter) @round(*num,scale) @rpad(*str,*len,padStr) @second(datetime) @sequence(varName,padLen,padStr) @sequenceMonth(varName,padLen,padStr) @sequenceYear(varName,padLen,padStr) @serverInstance() @serverProperty(*name) @sha256(*str,*password) @sid() @sqlClauseOfManager(*fieldName,isSubDepartment) @sqlSet(*sql,separator,cc) @sqlValue(*sql,cc) @strAdd(str1,str2) @substring(*str,begin,end) @sysProperty(name) @taskBeginTime(taskInstId) @taskCostTime(taskInstId) @taskDueTime(taskInstId) @taskEndTime(taskInstId) @taskExpireTime(taskInstId) @taskExt1(taskInstId) @taskExt2(taskInstId) @taskExt3(taskInstId) @taskExt4(taskInstId) @taskExt5(taskInstId) @taskExt6(taskInstId) @taskExt7(taskInstId) @taskExt8(taskInstId) @taskHumanType(taskInstId) @taskId() @taskOwner(taskInstId) @taskPreHumanTaskId(taskInstId) @taskPreTaskId(taskInstId) @taskPriority(taskInstId) @taskReadTime(taskInstId) @taskStatus(taskInstId) @taskTarget(taskInstId) @taskTitle(taskInstId) @teamUsers(*teamId,delimiter) @time(datetime) @timestemp() @trim(*str) @uid(uidAliasName,delimiter) @upper(*str) @urlDecode(*str) @urlEncode(*str,charset) @user(key,uidAliasName,delimiter) @userEmail(uidAliasName,delimiter) @userExt1(uidAliasName,delimiter) @userExt2(uidAliasName,delimiter) @userExt3(uidAliasName,delimiter) @userExt4(uidAliasName,delimiter) @userExt5(uidAliasName,delimiter) @userManager(uidAliasName,type,delimiter,includeSelf) @userMobile(uidAliasName,delimiter) @userName(uidAliasName,delimiter) @userNo(uidAliasName,delimiter) @userPhoto(uidAliasName) @userPositionLayer(uidAliasName,delimiter) @userPositionName(uidAliasName,delimiter) @userPositionNo(uidAliasName,delimiter) @userTel(uidAliasName,delimiter) @userUniqueId(uidAliasName,delimiter) @uuid() @weekDay(date) @weekOfYear(date) @year(date) ", keywords = "SUM MAX MIN AVG COUNT ", atParams = "", isSeverKeys = !1, exPressData = typeof window.atExpressKeywords != "undefined" ? window : window.settingParam && typeof window.settingParam.atExpressKeywords != "undefined" ? window.settingParam : typeof settingParam != "undefined" ? eval("settingParam") : null;
    exPressData != null && exPressData.atExpressKeywords != null ? (defaultAtExpressKeywords = exPressData.atExpressKeywords, isSeverKeys = !0) : keywords += defaultAtExpressKeywords.replace(/\(.*?\)/g, ""), exPressData != null && exPressData.formulaLabelMap != null && (window.formulaLabelMap = exPressData.formulaLabelMap);
    let boKeywords = "";
    exPressData != null && exPressData.boExpressKeywords != null && (boKeywords = exPressData.boExpressKeywords);
    function set(r) {
      for (var t = {}, d = r.split(" "), a = 0; a < d.length; ++a)
        t[d[a]] = !0;
      return t;
    }
    function getKeyWords() {
      var r = {}, t = {};
      if (isSeverKeys) {
        t = JSON.parse(defaultAtExpressKeywords);
        for (let i = 0; i < t.length; i++) {
          var d = t[i];
          r[d.key] = d, keywords += d.key.replace(/\(.*?\)/g, " ");
        }
      } else
        r = set(defaultAtExpressKeywords);
      for (var a = 0; a < boKeywords.length; a++)
        r[boKeywords[a].id] = boKeywords[a], keywords += boKeywords[a].id + " ", boKeywords[a].id.indexOf(".") > -1 && (keywords += boKeywords[a].id.split(".")[1] + " ");
      return r;
    }
    CodeMirror.defineMIME("awsAt", {
      name: "atformula",
      keywords: getKeyWords(),
      atKeywords: set(keywords),
      atoms: set("false true null unknown"),
      operatorChars: /^[*+\-%<>!=&|^]/,
      bokeys: set(atParams)
    });
  }();
});
